<?php

include("classes/include.php");

session_start();
if( isset($_SESSION['utilisateur'] ))
            		{
if(isset($_GET['action']))
{
	if($_GET['action'] == "deco")
	{
		session_destroy();
	}
}

if(isset($_POST['id_id']) && isset($_POST['id_ps']))
{

	$login = $_POST['id_id'];
	$mdp = $_POST['id_ps'];

	//$utilisateur = new Etudiant();

	$mess = Utilisateur::identifierInternaute($login,$mdp);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>ActuStage</title>
	<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">
	function effacerid(){

		document.getElementById( 'identifiant' ).value = "" ;
	}
		function effacermdp(){
		
		document.getElementById( 'mot_de_passe' ).value = "" ;
	}
		function remplirid(){
		if (!document.getElementById( 'identifiant' ).value){
		document.getElementById( 'identifiant' ).value = "Nom d'utilisateur";}
	}
		function remplirmdp(){
		if (!document.getElementById( 'mot_de_passe' ).value ){
		document.getElementById( 'mot_de_passe' ).value = "Mot de passe" ;}
	}
	
	function menu(){
				
				document.getElementById('sub').style.display = 'block';
			
			}
			function sortie(){
				
				document.getElementById('sub').style.display = 'none';
			
			}
				
	</script>
<body>

	<div id="container">
		<div id="bandeau">
			<a href="index.php"><img src="images/banniere.jpg" width="906" height="110" alt="" /></a> 
            <div id="adh">
	<?php 
             	if(!isset($_SESSION['utilisateur']))
            	{
					?>
<form action="envoyerSujet.php" method="post">
<input id="identifiant" name="id_id" class="input" value="Nom d'utilisateur" onClick="effacerid();" onblur="remplirid();" style="height:10px;font-size:8pt;" />
			<input id="mot_de_passe" name="id_ps" type="password" value="Mot de passe" onClick="effacermdp();" onblur="remplirmdp();" class="input" style="height:10px;font-size:8pt;" />
			<input type="submit" value="ok" style="font-size:8pt;" alt="" />
			</form>
			<script type="text/javascript">
					function effacerid(){
						document.getElementById( 'identifiant' ).value = "" ;
					}
					function effacermdp(){
						document.getElementById( 'mot_de_passe' ).value = "" ;
					}
					function remplirid(){
						if (!document.getElementById( 'identifiant' ).value){
							document.getElementById( 'identifiant' ).value = "Nom d'utilisateur";}
					}
					function remplirmdp(){
						if (!document.getElementById( 'mot_de_passe' ).value ){
							document.getElementById( 'mot_de_passe' ).value = "Mot de passe" ;}
					}
	
				
				</script>
		     <?php
				}
				else
				if(isset($_SESSION['utilisateur']))
            	{
					$nom = $_SESSION['utilisateur']->getNomUtilisateur();
					$prenom = $_SESSION['utilisateur']->getPrenomUtilisateur();
					?>
					<span style="font-variant: normal-caps;color:#FFF;margin-right:232px;font-size:10pt;"><?php echo 'Bienvenue ', $prenom,' ', $nom; ?></span>
                    <?php                   
				}
			?>
	</div>
            </div>
    	<div class="clear"></div>
      
	<?php   
    include("menu.php");
    ?>

	<div id="contenu">
		<div id="texteaccueil"> 
        <div id="titreAcceuil">
       				 <h2>Envoyer rapport et soutenance de stage <br /> <img src="images/traitBleu.png"width="700" height="3" alt="" /></h2>
       			</div>		
       		<div id="texte">
       <div id="envoi">
       <form action="envoyerSujet.php" method="post" enctype="multipart/form-data" name="form1" >
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
  
  <td>
  <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  <tr>
  <td><strong>Uploader rapport </strong></td>
  </tr>
  <tr>
  <td>Selectionner le fichier doc
  <input name="rapport" type="file" size="50" /></td>
  </tr> 
  <tr>
  <td align="center"><input type="submit" id="form1" value="envoyer" /></td>
  </tr>
  </table>
  </td>

  </tr>
  </table>
  
  
        <form action="envoyerSujet.php" method="post" enctype="multipart/form-data" name="form2" >
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
  
  <td>
  <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  <tr>
  <td><strong>Uploader soutenance</strong></td>
  </tr>
  <tr>
  <td>Selectionner le fichier ppt
  <input name="soutenance" type="file" size="50" /></td>
  </tr>
  <tr>
  <td align="center"><input type="submit" id="form2" value="envoyer" /></td>
  </tr>
  </table>
  </td>

  </tr>
  </table>
  

           <?php

   $identifiant = $_SESSION['utilisateur']->getLogin();
   if(isset($_FILES['rapport']) &&  isset($identifiant) ){
   	
		if( stripos($_FILES['rapport']["name"],".doc")){
	
		    
		  
		   if($_FILES['rapport']["error"] == 0){
		    $rapportEtudiant = new Document($_SESSION['utilisateur']->getNumEtudiant(), $_FILES['rapport']);
		    $type="rapport";
		    $rapportEtudiant->upload($type, $identifiant);
		   }
		}
   
   }
    
   if(isset($_FILES['soutenance']) &&  isset($identifiant)){
   if(stripos($_FILES['soutenance']["name"],".ppt")){ 
     
   if($_FILES['soutenance']["error"] == 0){
    $rapportEtudiant = new Document($_SESSION['utilisateur']->getNumEtudiant(), $_FILES['soutenance']);
      $type="soutenance";
    $rapportEtudiant->upload($type, $identifiant);
   }
      
   }
      }
 

?>
  
     </form>
       </div>	
        </div>    
       
 
    
 		    <div class="clear">
            </div>
            <div id="bas">
    Université d'Evry-Val-d'Essonne Boulevard François Mitterrand 91025 Evry Cedex
<br />

<a href="contacts.php">Contacts</a>|<a href="planSite.php">Plan du site</a>|<a href="informationsLegales.php">Informations légales</a> 
	</div>
        </div>
	</div>
	<div class="clear"></div>
    <div class="clear"></div>
	
</div>


  



</body>
</html>
<?php 
            		}

?>